package com.craterhill.java.ccp.dao;

import java.sql.ResultSet;
import java.sql.SQLException;

import com.craterhill.java.ccp.common.beans.Section;
import com.craterhill.java.ccp.dao.impl.AbstractDao;
import com.craterhill.java.ccp.dao.utils.CCPResultSetExtractor;

public interface SectionsDao extends CCPDao<Section> {
	public final String FIELD_LIST = " obj.department_id, obj.section_id, obj.section_name, obj.section_no " + AbstractDao.MONITER_FIELDS;
	public final String FIND_ALL_SECTIONS = " select " + FIELD_LIST + " from sections obj ";
	
	public final class SectionsExtractor extends CCPResultSetExtractor<Section>{
		@Override
		protected Section extractResultSetData(ResultSet resultSet) throws SQLException {
			Section sections = new Section();
			sections.setDepartmentId(resultSet.getInt(1));
			sections.setSectionId(resultSet.getInt(2));
			sections.setSectionName(resultSet.getString(3));
			sections.setSectionNo(resultSet.getString(4));
			sections.setStatus(resultSet.getBoolean(5));
			sections.setCreatedBy(resultSet.getInt(6));
			sections.setModifiedBy(resultSet.getInt(7));
			sections.setCreatedDate(resultSet.getDate(8));
			sections.setModifiedDate(resultSet.getDate(9));
			return sections;
			
		}
		
	}

}
